package com.zkthink.ceres.order.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zkthink.base.entity.Entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 购买者从购物中获得的利润(折扣和贡献值)
 * </p>
 *
 * @author kellen
 * @since 2020-08-22
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ceres_sales_profit_order")
@ApiModel(value = "Sales", description = "分销者从购物中获得的利润(折扣现金)")
@AllArgsConstructor
public class SalesProfitOrder extends Entity<Long> {


    private static final long serialVersionUID = 1L;

    /**
     * 分销人id
     */
    @ApiModelProperty(value = "分销人id")
    @TableField("frist_sales")
    @Excel(name = "分销人id")
    private Long fristSales;

    /**
     * 分销人获得的现金
     */
    @ApiModelProperty(value = "分销人获得的现金")
    @TableField("frist_cash")
    @Excel(name = "分销人获得的现金")
    private Long fristCash = 0L;

    /**
     * 分销人获得到的折扣
     */
    @ApiModelProperty(value = "分销人获得到的折扣")
    @TableField("frist_discount")
    @Excel(name = "分销人获得到的折扣")
    private Long fristDiscount = 0L;

    /**
     * 分销人获得到的贡献值
     */
    @ApiModelProperty(value = "分销人获得到的贡献值")
    @TableField("frist_contribution")
    @Excel(name = "分销人获得到的贡献值")
    private Long fristContribution = 0L;


    /**
     * 分销直接推荐人
     */
    @ApiModelProperty(value = "分销直接推荐人id")
    @TableField("second_sales")
    @Excel(name = "分销直接推荐人id")
    private Long secondSales;

    /**
     * 分销直接推荐人获得的现金
     */
    @ApiModelProperty(value = "分销直接推荐人获得的现金")
    @TableField("second_cash")
    @Excel(name = "分销直接推荐人获得的现金")
    private Long secondCash = 0L;

    /**
     * 分销直接推荐得到的贡献值
     */
    @ApiModelProperty(value = "分销直接推荐人获得到的贡献值")
    @TableField("second_contribution")
    @Excel(name = "分销直接推荐人人获得到的贡献值")
    private Long secondContribution = 0L;

    /**
     * 分销直接推荐人获得到的折扣
     */
    @ApiModelProperty(value = "分销直接推荐人获得到的折扣")
    @TableField("second_discount")
    @Excel(name = "分销直接推荐人获得到的折扣")
    private Long secondDiscount = 0L;


    /**
     * 分销资深推荐人
     */
    @ApiModelProperty(value = "分销资深推荐人id")
    @TableField("third_sales")
    @Excel(name = "分销资深推荐人id")
    private Long thirdSales;

    /**
     * 分销资深推荐人获得的现金
     */
    @ApiModelProperty(value = "分销资深推荐人获得的现金")
    @TableField("third_cash")
    @Excel(name = "分销资深推荐人获得的现金")
    private Long thirdCash = 0L;

    /**
     * 分销资深推荐人获得到的折扣
     */
    @ApiModelProperty(value = "分销资深推荐人获得到的折扣")
    @TableField("third_discount")
    @Excel(name = "分销资深推荐人获得到的折扣")
    private Long thirdDiscount = 0L;

    /**
     * 分销资深推荐得到的贡献值
     */
    @ApiModelProperty(value = "分销资深推荐人获得到的贡献值")
    @TableField("third_contribution")
    @Excel(name = "分销资深推荐人获得到的贡献值")
    private Long thirdContribution = 0L;


    /**
     * 平台现金
     */
    @ApiModelProperty(value = "平台现金")
    @TableField("plateform_cash")
    @Excel(name = "平台现金")
    private Long plateformCash = 0L;


    /**
     * 订单号
     */
    @ApiModelProperty(value = "订单号")
    @NotEmpty(message = "订单号不能为空")
    @Length(max = 16, message = "订单号长度不能超过16")
    @TableField(value = "order_no", condition = LIKE)
    @Excel(name = "订单号")
    private Long orderNo;
    /**
     * 商户编号
     */
    @ApiModelProperty(value = "商户编号")
    @NotEmpty(message = "商户编号不能为空")
    @TableField(value = "tenant_code", condition = LIKE)
    @Excel(name = "商户编号")
    private String tenantCode;
    /**
     * 产品id
     */
    @ApiModelProperty(value = "产品id")
    @TableField("product_id")
    @Excel(name = "产品id")
    private Long productId;

    /**
     * 结算状态 1未结算 2已结算
     */
    @ApiModelProperty(value = "结算状态 1未结算 2已结算")
    @NotNull(message = "结算状态 1未结算 2已结算不能为空")
    @TableField("settle_status")
    @Excel(name = "结算状态 1未结算 2已结算")
    private Integer settleStatus;

    /**
     * 订单实付金额
     */
    @ApiModelProperty(value = "订单实付金额")
    @NotNull(message = "订单实付金额不能为空")
    @TableField("order_amount")
    @Excel(name = "订单实付金额")
    private Long orderAmount;
    /**
     * 逻辑删除 1-删除 0-未删除
     */
    @ApiModelProperty(value = "逻辑删除 1-删除 0-未删除")
    @NotNull(message = "逻辑删除 1-删除 0-未删除不能为空")
    @TableField("is_delete")
    @Excel(name = "逻辑删除 1-删除 0-未删除")
    @TableLogic
    private Integer isDelete;

    @Builder
    public SalesProfitOrder(Long id, LocalDateTime updateTime, Long updateUser, LocalDateTime createTime, Long createUser, Integer isDelete,
                            Integer settleStatus, Long orderAmount, Long orderNo, String tenantCode,
                            Long fristSales, Long fristCash, Long fristDiscount,
                            Long secondSales, Long secondCash, Long secondDiscount,
                            Long thirdSales, Long thirdCash, Long thirdDiscount,
                            Long plateformCash, Long productId,
                            Long fristContribution, Long secondContribution, Long thirdContribution) {
        this.id = id;
        this.updateTime = updateTime;
        this.updateUser = updateUser;
        this.createTime = createTime;
        this.createUser = createUser;
        this.isDelete = isDelete;
        this.orderAmount = orderAmount;
        this.settleStatus = settleStatus;
        this.orderNo = orderNo;
        this.tenantCode = tenantCode;
        this.fristSales = fristSales;
        this.fristCash = fristCash;
        this.fristDiscount = fristDiscount;
        this.secondSales = secondSales;
        this.secondCash = secondCash;
        this.secondDiscount = secondDiscount;
        this.thirdSales = thirdSales;
        this.thirdCash = thirdCash;
        this.thirdDiscount = thirdDiscount;
        this.plateformCash = plateformCash;
        this.productId = productId;
        this.fristContribution = fristContribution;
        this.secondContribution = secondContribution;
        this.thirdCash = thirdCash;
        this.thirdContribution = thirdContribution;

    }
}

